import Main from "../view/main/main";
import parentView from "@/components/parent-view";
import router from "@/router";
import store from "@/store";

let configRouter = [
  {
    path: "/",
    name: "login",
    meta: {
      title: "Login - 登录",
      hideInMenu: true
    },
    component: () => import("../view/login/login.vue")
  },
  {
    path: "/login",
    name: "login",
    meta: {
      title: "Login - 登录",
      hideInMenu: true
    },
    component: () => import("../view/login/login.vue")
  },
  {
    path: '/401',
    name: 'error_401',
    meta: {
      hideInMenu: true
    },
    component: () => import('@/view/error-page/401.vue')
  },
  {
    path: '/500',
    name: 'error_500',
    meta: {
      hideInMenu: true
    },
    component: () => import('@/view/error-page/500.vue')
  },
  {
    path: '*',
    name: 'error_404',
    meta: {
      hideInMenu: true
    },
    component: () => import('@/view/error-page/404.vue')
  },
  {
    path: "/main",
    name: "总概",
    meta: {
      title: "总概",
      hideInNav: true
    },
    component: Main,
    children: [
      {
        path: "home",
        name: "home",
        meta: {
          icon: "md-speedometer",
          title: "总概"
        },
        component: parentView,
        children: [
          {
            path: "home",
            name: "home",
            meta: {
              icon: "md-speedometer",
              title: "总概"
            },
            component: () => import("@/view/home/home.vue")
          },
        ]
      }
    ]
  },
  {
    path: "/main",
    name: "logisticsManagement",
    meta: {
      icon: "md-construct",
      title: "后勤管理",
      showAlways: true,
    },
    component: Main,
    children: [
      /*
      {
        path: "yy-workorder",
        name: "yy-workorder",
        meta: {
          icon: "arrow-graph-up-right",
          title: "工单管理",
        },
        component: parentView,
        children: [
          {
            path: "yy-gd-repair-management",
            name: "yy-gd-repair-management",
            meta: {
              icon: "arrow-graph-up-right",
              title: "工单报修与管理"
            },
            component: () => import("@/view/yy-workorder-manage/yy-gd-repair-management/yy-gd-repair-management.vue")
          },
          {
            path: "yy-gd-accept-deal-manage",
            name: "yy-gd-accept-deal-manage",
            meta: {
              icon: "arrow-graph-up-right",
              title: "工单受理管理"
            },
            component: () => import("@/view/yy-workorder-manage/yy-gd-accept-deal-manage/yy-gd-accept-deal-manage.vue")
          },
          {
            path: "yy-gd-receive-order-manage",
            name: "yy-gd-receive-order-manage",
            meta: {
              icon: "arrow-graph-up-right",
              title: "工单接单管理"
            },
            component: () => import("@/view/yy-workorder-manage/yy-gd-receive-order-manage/yy-gd-receive-order-manage.vue")
          },
          {
            path: "yy-gd-perform-manage",
            name: "yy-gd-perform-manage",
            meta: {
              icon: "arrow-graph-up-right",
              title: "工单执行管理"
            },
            component: () => import("@/view/yy-workorder-manage/yy-gd-perform-manage/yy-gd-perform-manage.vue")
          },
          {
            path: "yy-gd-Integrated-query",
            name: "yy-gd-Integrated-query",
            meta: {
              icon: "arrow-graph-up-right",
              title: "工单综合查询"
            },
            component: () => import("@/view/yy-workorder-manage/yy-gd-Integrated-query/yy-gd-Integrated-query.vue")
          },
          {
            path: "yy-screen-show",
            name: "yy-screen-show",
            meta: {
              icon: "arrow-graph-up-right",
              title: "大屏展示"
            },
            component: () => import("@/view/yy-workorder-manage/yy-screen-show/yy-screen-show.vue")
          },
          {
            path: "yy-scheduling-screen-show",
            name: "yy-scheduling-screen-show",
            meta: {
              icon: "arrow-graph-up-right",
              title: "调度大屏展示"
            },
            component: () => import("@/view/yy-workorder-manage/yy-scheduling-screen-show/yy-scheduling-screen-show.vue")
          },
        ]
      },
      */

      {
        path: "yy-warehouse",
        name: "yy-warehouse",
        meta: {
          icon: "arrow-graph-up-right",
          title: "工程仓库",
        },
        component: parentView,
        children: [
          {
            path: "yy-supplier-manage",
            name: "yy-supplier-manage",
            meta: {
              icon: "arrow-graph-up-right",
              title: "供应商管理"
            },
            component: () => import("@/view/yy-warehouse-manage/yy-supplier-manage/yy-supplier-manage.vue")
          },
          {
            path: "yy-goods-cateogory",
            name: "yy-goods-cateogory",
            meta: {
              icon: "arrow-graph-up-right",
              title: "物品类别"
          },
            component: () => import("@/view/yy-warehouse-manage/yy-goods-cateogory/yy-goods-cateogory.vue")
          },
          {
            path: "yy-goods-manage",
            name: "yy-goods-manage",
            meta: {
              icon: "arrow-graph-up-right",
              title: "物品管理"
          },
            component: () => import("@/view/yy-warehouse-manage/yy-goods-manage/yy-goods-manage.vue")
          },
          {
            path: "yy-put-in-manage",
            name: "yy-put-in-manage",
            meta: {
              icon: "arrow-graph-up-right",
              title: "入库管理"
            },
            component: () => import("@/view/yy-warehouse-manage/yy-put-in-manage/yy-put-in-manage.vue")
          },
          {
            path: "yy-out-in-manage",
            name: "yy-out-in-manage",
            meta: {
              icon: "arrow-graph-up-right",
              title: "出库管理"
            },
            component: () => import("@/view/yy-warehouse-manage/yy-out-in-manage/yy-out-in-manage.vue")
          },
          {
            path: "yy-store-list",
            name: "yy-store-list",
            meta: {
              icon: "arrow-graph-up-right",
              title: "库存清单"
            },
            component: () => import("@/view/yy-warehouse-manage/yy-store-list/yy-store-list.vue")
          },
          {
            path: "yy-parameter-record",
            name: "yy-parameter-record",
            meta: {
              icon: "arrow-graph-up-right",
              title: "台账记录"
            },
            component: () => import("@/view/yy-warehouse-manage/yy-parameter-record/yy-parameter-record.vue")
          },
          {
            path: "yy-sell-store-report",
            name: "yy-sell-store-report",
            meta: {
              icon: "arrow-graph-up-right",
              title: "进销存报表"
            },
            component: () => import("@/view/yy-warehouse-manage/yy-sell-store-report/yy-sell-store-report.vue")
          },
          {
            path: "yy-month-reports",
            name: "yy-month-reports",
            meta: {
              icon: "arrow-graph-up-right",
              title: "月度结转"
            },
            component: () => import("@/view/yy-warehouse-manage/yy-month-reports/yy-month-reports.vue")
          }
        ]
      },
      
      /*
      {
        path: "yy-dangerouschemicals",
        name: "yy-dangerouschemicals",
        meta: {
          icon: "arrow-graph-up-right",
          title: "危化品管理",
        },
        component: parentView,
        children: [
          {
            path: "yy-whp-supplier-manage",
            name: "yy-whp-supplier-manage",
            meta: {
              icon: "arrow-graph-up-right",
              title: "供应商管理"
            },
            component: () => import("@/view/yy-dangerouschemicals-manage/yy-whp-supplier-manage/yy-whp-supplier-manage.vue")
          },
          {
            path: "yy-whp-goods-cateogory",
            name: "yy-whp-goods-cateogory",
            meta: {
              icon: "arrow-graph-up-right",
              title: "危化品类别"
            },
            component: () => import("@/view/yy-dangerouschemicals-manage/yy-whp-goods-cateogory/yy-whp-goods-cateogory.vue")
          },
          {
            path: "yy-whp-goods-manage",
            name: "yy-whp-goods-manage",
            meta: {
              icon: "arrow-graph-up-right",
              title: "危化品总览"
            },
            component: () => import("@/view/yy-dangerouschemicals-manage/yy-whp-goods-manage/yy-whp-goods-manage.vue")
          },
          {
            path: "yy-whp-put-in-manage",
            name: "yy-whp-put-in-manage",
            meta: {
              icon: "arrow-graph-up-right",
              title: "入库管理"
            },
            component: () => import("@/view/yy-dangerouschemicals-manage/yy-whp-put-in-manage/yy-whp-put-in-manage.vue")
          },
          {
            path: "yy-whp-out-in-manage",
            name: "yy-whp-out-in-manage",
            meta: {
              icon: "arrow-graph-up-right",
              title: "出库管理"
            },
            component: () => import("@/view/yy-dangerouschemicals-manage/yy-whp-out-in-manage/yy-whp-out-in-manage.vue")
          },
          {
            path: "yy-whp-store-list",
            name: "yy-whp-store-list",
            meta: {
              icon: "arrow-graph-up-right",
              title: "库存清单"
            },
            component: () => import("@/view/yy-dangerouschemicals-manage/yy-whp-store-list/yy-whp-store-list.vue")
          },
          {
            path: "yy-whp-parameter-record",
            name: "yy-whp-parameter-record",
            meta: {
              icon: "arrow-graph-up-right",
              title: "台账记录"
            },
            component: () => import("@/view/yy-dangerouschemicals-manage/yy-whp-parameter-record/yy-whp-parameter-record.vue")
          },
          {
            path: "yy-whp-sell-store-report",
            name: "yy-whp-sell-store-report",
            meta: {
              icon: "arrow-graph-up-right",
              title: "进销存报表"
            },
            component: () => import("@/view/yy-dangerouschemicals-manage/yy-whp-sell-store-report/yy-whp-sell-store-report.vue")
          },
          {
            path: "yy-whp-month-reports",
            name: "yy-whp-month-reports",
            meta: {
              icon: "arrow-graph-up-right",
              title: "月度结转"
            },
            component: () => import("@/view/yy-dangerouschemicals-manage/yy-whp-month-reports/yy-whp-month-reports.vue")
          }
        ]
      },

      {
        path: "yy-equipment",
        name: "yy-equipment",
        meta: {
          icon: "arrow-graph-up-right",
          title: "设备管理",
        },
        component: parentView,
        children: [
          {
            path: "yy-equipment-parameter-manage",
            name: "yy-equipment-parameter-manage",
            meta: {
              icon: "arrow-graph-up-right",
              title: "设备台账"
            },
            component: () => import("@/view/yy-equipment-manage/yy-equipment-parameter-manage/yy-equipment-parameter-manage.vue")
          },
          {
            path: "yy-qrcode-manage",
            name: "yy-qrcode-manage",
            meta: {
              icon: "arrow-graph-up-right",
              title: "设备二维码"
            },
            component: () => import("@/view/yy-equipment-manage/yy-qrcode-manage/yy-qrcode-manage.vue")
          },
          {
            path: "yy-equipment-warning-manage",
            name: "yy-equipment-warning-manage",
            meta: {
              icon: "arrow-graph-up-right",
              title: "设备预警管理"
            },
            component: () => import("@/view/yy-equipment-manage/yy-equipment-warning-manage/yy-equipment-warning-manage.vue")
          },
          {
            path: "yy-dictionary-manage",
            name: "yy-dictionary-manage",
            meta: {
              icon: "arrow-graph-up-right",
              title: "字典管理"
            },
            component: () => import("@/view/yy-equipment-manage/yy-dictionary-manage/yy-dictionary-manage.vue")
          },
        ]
      },

      {
        path: "yy-inspection",
        name: "yy-inspection",
        meta: {
          icon: "arrow-graph-up-right",
          title: "巡检管理",
        },
        component: parentView,
        children: [
          {
            path: "yy-inspection-items-manage",
            name: "yy-inspection-items-manage",
            meta: {
              icon: "arrow-graph-up-right",
              title: "巡检条目管理"
            },
            component: () => import("@/view/yy-inspection-manage/yy-inspection-items-manage/yy-inspection-items-manage.vue")
          },
          {
            path: "yy-inspection-content",
            name: "yy-inspection-content",
            meta: {
              icon: "arrow-graph-up-right",
              title: "巡检内容"
            },
            component: () => import("@/view/yy-inspection-manage/yy-inspection-content/yy-inspection-content.vue")
          },
          {
            path: "yy-inspection-plan",
            name: "yy-inspection-plan",
            meta: {
              icon: "arrow-graph-up-right",
              title: "巡检计划"
            },
            component: () => import("@/view/yy-inspection-manage/yy-inspection-plan/yy-inspection-plan.vue")
          },
          {
            path: "yy-inspection-tasks",
            name: "yy-inspection-tasks",
            meta: {
              icon: "arrow-graph-up-right",
              title: "巡检任务"
            },
            component: () => import("@/view/yy-inspection-manage/yy-inspection-tasks/yy-inspection-tasks.vue")
          },
          {
            path: "yy-integrated-management",
            name: "yy-integrated-management",
            meta: {
              icon: "arrow-graph-up-right",
              title: "综合管理"
            },
            component: () => import("@/view/yy-inspection-manage/yy-integrated-management/yy-integrated-management.vue")
          },
          {
            path: "yy-abnormal-project-query",
            name: "yy-abnormal-project-query",
            meta: {
              icon: "arrow-graph-up-right",
              title: "异常项目查询"
            },
            component: () => import("@/view/yy-inspection-manage/yy-abnormal-project-query/yy-abnormal-project-query.vue")
          },
        ]
      },

      {
        path: "yy-knowledgebase",
        name: "yy-knowledgebase",
        meta: {
          icon: "arrow-graph-up-right",
          title: "知识库管理",
        },
        component: parentView,
        children: [
          {
            path: "yy-knowledgebase-maintenance",
            name: "yy-knowledgebase-maintenance",
            meta: {
              icon: "arrow-graph-up-right",
              title: "知识库维护"
            },
            component: () => import("@/view/yy-knowledgebase-manage/yy-knowledgebase-maintenance/yy-knowledgebase-maintenance.vue")
          },
          {
            path: "yy-knowledgebase-retrieval",
            name: "yy-knowledgebase-retrieval",
            meta: {
              icon: "arrow-graph-up-right",
              title: "知识库检索"
            },
            component: () => import("@/view/yy-knowledgebase-manage/yy-knowledgebase-retrieval/yy-knowledgebase-retrieval.vue")
          },
        ]
      },

      {
        path: "yy-announcement",
        name: "yy-announcement",
        meta: {
          icon: "arrow-graph-up-right",
          title: "辅助",
        },
        component: parentView,
        children: [
          {
            path: "yy-announcement-management",
            name: "yy-announcement-management",
            meta: {
              icon: "arrow-graph-up-right",
              title: "公告管理"
            },
            component: () => import("@/view/yy-announcement-manage/yy-announcement-management/yy-announcement-management.vue")
          }
        ]
      },
      */
    ]
  },
  /*
  {
    path: "/main",
    name: "systemManagement",
    meta: {
      icon: "md-cog",
      title: "系统管理",
      showAlways: true,
    },
    component: Main,
    children: [
      {
        path: "yy-operationalconfig",
        name: "yy-operationalconfig",
        meta: {
          icon: "arrow-graph-up-right",
          title: "运维配置",
        },
        component: parentView,
        children: [
          {
            path: "yy-employees-manage",
            name: "yy-employees-manage",
            meta: {
              icon: "arrow-graph-up-right",
              title: "员工管理"
            },
            component: () => import("@/view/yy-operationalconfig-manage/yy-employees-manage/yy-employees-manage.vue")
          },
          {
            path: "yy-role-manage",
            name: "yy-role-manage",
            meta: {
              icon: "arrow-graph-up-right",
              title: "角色管理"
            },
            component: () => import("@/view/yy-operationalconfig-manage/yy-role-manage/yy-role-manage.vue")
          },
          {
            path: "yy-department-manage",
            name: "yy-department-manage",
            meta: {
              icon: "arrow-graph-up-right",
              title: "部门管理"
            },
            component: () => import("@/view/yy-operationalconfig-manage/yy-department-manage/yy-department-manage.vue")
          },
          {
            path: "yy-warehouse-manage",
            name: "yy-warehouse-manage",
            meta: {
              icon: "arrow-graph-up-right",
              title: "仓库管理"
            },
            component: () => import("@/view/yy-operationalconfig-manage/yy-warehouse-manage/yy-warehouse-manage.vue")
          },
          {
            path: "yy-warehouse-permissions-manage",
            name: "yy-warehouse-permissions-manage",
            meta: {
              icon: "arrow-graph-up-right",
              title: "仓库权限管理"
            },
            component: () => import("@/view/yy-operationalconfig-manage/yy-warehouse-permissions-manage/yy-warehouse-permissions-manage.vue")
          },
          {
            path: "yy-maintenance-time-manage",
            name: "yy-maintenance-time-manage",
            meta: {
              icon: "arrow-graph-up-right",
              title: "维修工时管理"
            },
            component: () => import("@/view/yy-operationalconfig-manage/yy-maintenance-time-manage/yy-maintenance-time-manage.vue")
          },
          {
            path: "yy-maintenance-projects",
            name: "yy-maintenance-projects",
            meta: {
              icon: "arrow-graph-up-right",
              title: "维修项目"
            },
            component: () => import("@/view/yy-operationalconfig-manage/yy-maintenance-projects/yy-maintenance-projects.vue")
          },
          {
            path: "yy-place-manage",
            name: "yy-place-manage",
            meta: {
              icon: "arrow-graph-up-right",
              title: "地点管理"
            },
            component: () => import("@/view/yy-operationalconfig-manage/yy-place-manage/yy-place-manage.vue")
          },
          {
            path: "yy-phone-manage",
            name: "yy-phone-manage",
            meta: {
              icon: "arrow-graph-up-right",
              title: "电话管理"
            },
            component: () => import("@/view/yy-operationalconfig-manage/yy-phone-manage/yy-phone-manage.vue")
          },
        ]
      },
    ]
  }
  */
];

router.addRoutes(configRouter);

store.commit('setRouter',configRouter);

router.beforeEach((to, from, next) => {
  router.customBeforeEach(to, from, next, configRouter);
});

router.afterEach(to => {
  router.customAfterEach(to);
});

export default router;
